<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>违法举报</title>
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=no" name="format-detection" />

    <link rel="stylesheet" href="css/demo.css" />
    <script src="js/ydui.flexible.js"></script>
    <style>
        .cell-left {
            width: 20%
        }
    </style>
</head>

<body>
    <section class="g-flexview">
        <header class="m-navbar">
            <a href="javascript:history.back();" class="navbar-item">
                <i class="back-ico"></i>
            </a>
            <div class="navbar-center">
                <span class="navbar-title">违法举报</span>
            </div>
        </header>

        <section class="g-scrollview">
            <div id="J_Tab" class="m-tab">
                <ul class="tab-nav">
                    <li class="tab-nav-item tab-active"><a href="javascript:;">意见反馈</a></li>
                    <li class="tab-nav-item"><a href="javascript:;">违法举报</a></li>
                </ul>

                <div class="tab-panel">
                    <!-- 意见反馈 -->
                    <div class="tab-panel-item tab-active" style="padding:0.24rem 0">
                        <div class="tab_fa">
                            <label class="cell-item">
                                    <span class="cell-left">意见</span>
                                    <label class="cell-right" style="flex: none;width:80%">
                                        <input type="radio" name="radio" checked/>
                                        <i class="cell-checkbox-icon"></i>
                                    </label>
                            </label>
                            <label class="cell-item">
                                    <span class="cell-left">建议</span>
                                    <label class="cell-right" style="flex: none;width:80%">
                                        <input type="radio" name="radio"/>
                                        <i class="cell-checkbox-icon"></i>
                                    </label>
                            </label>
                        </div>
                        <div class="cell_gray_b">
                            <div class="cell-item">
                                <div class="cell-right">
                                    <textarea class="cell-textarea bg_green_textarea" placeholder="请输入详细描述，以便客服核实。"></textarea>
                                </div>
                            </div>
                        </div>

                        <div class="demo-small-pitch ">
                            <div class="cell-item ">
                                <div class="cell-left ">联系方式</div>
                                <div class="cell-right ">
                                    <input type="text " class="cell-input " placeholder="请输入联系方式 " autocomplete="off " />
                                </div>
                            </div>
                        </div>

                    </div>
                    <!-- 违法举报 -->
                    <div class="tab-panel-item ">
                        <div class="tab_fa">
                            <label class="cell-item">
                                            <span class="cell-left">服务举报</span>
                                            <label class="cell-right" style="flex: none;width:80%">
                                                <input type="radio" name="radio" checked/>
                                                <i class="cell-checkbox-icon"></i>
                                            </label>
                            </label>
                            <label class="cell-item">
                                            <span class="cell-left">赛事举报</span>
                                            <label class="cell-right" style="flex: none;width:80%">
                                                <input type="radio" name="radio"/>
                                                <i class="cell-checkbox-icon"></i>
                                            </label>
                            </label>
                        </div>
                        <div class="cell_gray_b">
                            <div class="cell-item">
                                <div class="cell-right">
                                    <textarea class="cell-textarea bg_green_textarea" placeholder="请输入详细描述，以便客服核实。"></textarea>
                                </div>
                            </div>
                        </div>
                        <!--商品图片上传-->
                        <div class="container">
                            <!--    照片添加    -->
                            <div class="z_photo cell_gray_b">
                                <div class="z_file aui-iconfont aui-icon-plus">
                                    <!--<i class="aui-iconfont aui-icon-plus plus_g"></i>-->
                                    <input type="file" name="file" id="file" value="" accept="image/*" multiple onchange="imgChange('z_photo','z_file');" />
                                </div>

                            </div>

                            <!--遮罩层-->
                            <div class="z_mask">
                                <!--弹出框-->
                                <div class="z_alert">
                                    <p>确定要删除这张图片吗？</p>
                                    <p>
                                        <span class="z_cancel">取消</span>
                                        <span class="z_sure">确定</span>
                                    </p>
                                </div>
                            </div>
                        </div>
                        <div class="demo-small-pitch ">
                            <div class="cell-item ">
                                <div class="cell-left ">联系方式</div>
                                <div class="cell-right ">
                                    <input type="text " class="cell-input " placeholder="请输入联系方式 " autocomplete="off " />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="m-button ">
                    <button type="button " id="saveBtn " class="btn-block btn-primary ">提交</button>
                </div>
            </div>
        </section>

    </section>
    <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js "></script>
    <script src="js/ydui.js "></script>
    <script src="js/ydui.citys.js "></script>
</body>
<script>
    var $tab = $('#J_Tab');

    $tab.tab({
        nav: '.tab-nav-item',
        panel: '.tab-panel-item',
        activeClass: 'tab-active'
    });

    $tab.find('.tab-nav-item').on('open.ydui.tab', function(e) {
        console.log('索引：%s - [%s]正在打开', e.index, $(this).text());
    });

    $tab.find('.tab-nav-item').on('opened.ydui.tab', function(e) {
        console.log('索引：%s - [%s]已经打开了', e.index, $(this).text());
    });

    function imgChange(obj1, obj2) {
        //获取点击的文本框
        var file = document.getElementById("file");
        //存放图片的父级元素
        var imgContainer = document.getElementsByClassName(obj1)[0];
        //获取的图片文件
        var fileList = file.files;
        //文本框的父级元素
        var input = document.getElementsByClassName(obj2)[0];
        var imgArr = [];
        //遍历获取到得图片文件
        for (var i = 0; i < fileList.length; i++) {
            var imgUrl = window.URL.createObjectURL(file.files[i]);
            imgArr.push(imgUrl);
            var img = document.createElement("img");
            img.setAttribute("src", imgArr[i]);
            var imgAdd = document.createElement("div");
            imgAdd.setAttribute("class", "z_addImg");
            imgAdd.appendChild(img);
            imgContainer.appendChild(imgAdd);
        };
        imgRemove();
    };

    function imgRemove() {
        var imgList = document.getElementsByClassName("z_addImg");
        var mask = document.getElementsByClassName("z_mask")[0];
        var cancel = document.getElementsByClassName("z_cancel")[0];
        var sure = document.getElementsByClassName("z_sure")[0];
        for (var j = 0; j < imgList.length; j++) {
            imgList[j].index = j;
            imgList[j].onclick = function() {
                var t = this;
                mask.style.display = "block";
                cancel.onclick = function() {
                    mask.style.display = "none";
                };
                sure.onclick = function() {
                    mask.style.display = "none";
                    t.style.display = "none";
                };

            }
        };
    };
</script>

</html>